﻿using ZilLion.Service.Core.ConfigManager.Attribute;
using ZilLion.Service.Core.ConfigManager.Provider;

namespace ZilLion.Service.TaskPlatform.Domain
{
    [ConfigurationArgument(typeof(TaskManagerServiceConfig), typeof(JsonConfigProvider))]
    public class TaskManagerServiceConfig
    {
        // ReSharper disable once InconsistentNaming
        /// <summary>
        ///     配置数据库连接字符串
        ///     ex: SQLITE EX:data source=C:\Users\Mryan\Desktop\TaskManagerConfig.db
        ///     SQLSERVER EX:data source = SERVERNAME; initial catalog = DBNAME; user id = sa; pooling=true;min pool size=1;max
        ///     pool size=1;Connection Timeout = 0
        /// </summary>
        public string ConfigServerConn { get; set; }

        /// <summary>
        ///     包文件服务器连接字符串
        /// </summary>
        public string PackageServerConn { get; set; }

        public ReponsitoryType ReponsitoryType { get; set; }

        /// <summary>
        ///     放入服务配置 当任务超过重试次数发送邮件地址列表
        /// </summary>
        public string[] ErrorReports { get; set; }

        /// <summary>
        /// 任务熔断阈值
        /// </summary>
        public int ErrorStopThreshold { get; set; } = 5;
    }

    /// <summary>
    ///     存储仓库类型 server:数据存储到服务器上,local 数据存储到本地
    /// </summary>
    public enum ReponsitoryType
    {
        Local = 1,
        Server = 0
    }
}